package com.ruoyi.examApproval.controller;

import com.ruoyi.examApproval.domain.Approval;
import com.ruoyi.examApproval.service.IApprovalService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@Api(tags = "基础管理-审核信息")
@RestController
@RequestMapping("/approval")
public class ApprovalController extends BaseController
{
    @Autowired
    private IApprovalService IApprovalService;

                @ApiOperation("审核管理 - 获取审核信息")
    @GetMapping("/info")
    public AjaxResult getApproval(@RequestParam Long id)
    {
        return success(IApprovalService.selectApprovalById(id));
    }

                @ApiOperation("审核管理 - 查询审核列表")
    @GetMapping("/list")
    public AjaxResult listApprovals()
    {
        List<Approval> list = IApprovalService.selectApprovalList();
        return success(list);
    }

                @ApiOperation("审核管理 - 新增审核")
    @PostMapping("/add")
    public AjaxResult addApproval(@RequestBody Approval approval)
    {
        return toAjax(IApprovalService.insertApproval(approval));
    }

                @ApiOperation("审核管理 - 修改审核")
    @PutMapping("/edit")
    public AjaxResult editApproval(@RequestBody Approval approval)
    {
        return toAjax(IApprovalService.updateApproval(approval));
    }

                @ApiOperation("审核管理 - 删除审核")
    @DeleteMapping("/delete")
    public AjaxResult deleteApproval(@RequestParam Long id)
    {
        return toAjax(IApprovalService.deleteApprovalById(id));
    }
}
